<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	
	<link type="text/css" rel="stylesheet" href="/spring-GOP/css/movie/style_10.css">
	<link type="text/css" rel="stylesheet" href="/spring-GOP/css/movie/style_1020.css">
	<link type="text/css" rel="stylesheet" href="/spring-GOP/css/common.css">
	<link type="text/css" rel="stylesheet" href="/spring-GOP/css/style.css">
	<title>Primus</title>
 	<script type="text/javascript">
 		
 		function onSearchTitle() {
 			if(document.getElementById("movie_title").value == "") {
 				alert("내용을 입력하세요");
 			} else {
 	 			document.listForm.action="/spring-GOP/movie/list";
 	    		document.listForm.submit();
 			}
 		}
 		
 		function onSearchAll() {
 			document.getElementById("movie_title").value = "";
 			document.listForm.action="/spring-GOP/movie/list";
    		document.listForm.submit();
 		}
 		
 		function onAddMovie() {
 			document.location="/spring-GOP/movie/add";
 		}
 	</script>
</head>
<body>
	<!-- container -->
	<form name="listForm" method="post">
		<div id="container">
			<div id="content">
			
				<!-- <div> floating - 메인인 경우</div> -->
				<div id="main-shortCut">
					<div class="sub-main-section c10200000">
						<!-- 컨텐츠 작성 -->
						<div class="page-type1"></div>
						<div class="search">
							<!--<hr class="hr_search"> -->
							<fieldset>
								<legend>영화 제목 검색</legend>
								<dl class="title">
									<dt>
										<label for="movie_title">영화제목</label>
									</dt>

									<dd class="title">
										<input type="text" id="movie_title" name="searchMovieName" class="input_txt" value="<%-- <%=searchMovie%> --%>">
										<span class="search_btn">
											<button type="button" id="searchMovie" class="button w150 orange" onClick="onSearchTitle();">영화 검색</button>
											<button type="button" id="btnClear" class="button w97 white margin-left10" onClick="onSearchAll();">모든 영화 보기</button>
										</span>
									</dd>
								</dl>

							</fieldset>
							<div class="line2"></div>
							<div class="result">
								<h2>
									총 <strong>${movies.size()}</strong>건의 영화가 등록되어 있습니다.
								</h2>
							</div>
							<div class="line2"></div>
							<!--<hr class="hr_search"> -->
						</div>
						<div class="list">
							<!-- 검색 결과 리스트 -->
							<ul>
								<c:forEach var="movie" items="${movies}">
									<li>
										<a href="moviedetail?num=${movie.movie_num}">
											<img src="${movie.path}${movie.file_name}">
											<span class="info">
												<span class="title">
												<img src="/save/images/movie/common/over${movie.movie_grade}_small.png">${movie.movie_title}</span>
												<span class="open_date margin-top5">${movie.movie_releasedate} 개봉</span>
											</span>
										</a>
									</li>
								</c:forEach>
							</ul>
						</div>

						<div class="clear_both"></div>
						<div class="paging">
							<div class="page-box">
								<a class="on">1</a>
								<!-- <a href="">2</a>
								<a href="">3</a>
								<a class="next" href=""><img src=""></a> -->
							</div>
							<c:if test="${user != null}">
								<c:if test="${user.getMember_id() == 'admin' }">
									<div>
										<button type="button" id="addMovie" class="button w150 orange" onClick="onAddMovie();">영화 등록하기</button>
									</div>
								</c:if>
							</c:if>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
	<!-- //container -->
</body>
</html>